Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement basic async IO with timers #6505

Merged
merged 7 commits into from
Jan 13, 2025
Merged

feat: implement basic async IO with timers #6505

merged 7 commits into from
Jan 13, 2025

Conversation

hargoniX
Copy link
Contributor

@hargoniX hargoniX commented Jan 2, 2025

This PR implements a basic async framework as well as asynchronously running timers using libuv.

@hargoniX hargoniX added the changelog-language Language features, tactics, and metaprograms label Jan 2, 2025
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 2, 2025 08:05 Inactive
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jan 2, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Jan 2, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 8d9d81453bd28aa9799e6bf2ad52def1d75549cb --onto 2c87905d77b707c3283c1de759fd63269ac386a1. (2025-01-02 08:11:37)
  • ❗ Batteries CI can not be attempted yet, as the nightly-testing-2025-01-02 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Batteries CI should run now. (2025-01-02 08:57:50)
  • ✅ Mathlib branch lean-pr-testing-6505 has successfully built against this PR. (2025-01-07 00:23:05) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 0b5d97725cef10e064acb792faafc4b5cdd35b39 --onto d2c4471cfa4611977bf4927b5cd849df1a4272b7. (2025-01-10 16:11:26)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ed309dc2a4cda70f376b98a001dd734a17924d87 --onto d2c4471cfa4611977bf4927b5cd849df1a4272b7. (2025-01-13 18:12:58)

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 2, 2025 08:54 Inactive
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 6, 2025 23:35 Inactive
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jan 6, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jan 6, 2025
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Jan 7, 2025
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 10, 2025 15:57 Inactive
@hargoniX hargoniX changed the title feat: implement basic async IO feat: implement basic async IO with timers Jan 10, 2025
@hargoniX hargoniX added the release-ci Enable all CI checks for a PR, like is done for releases label Jan 10, 2025
@hargoniX hargoniX marked this pull request as ready for review January 10, 2025 16:23
@hargoniX hargoniX requested a review from TwoFX as a code owner January 10, 2025 16:23
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 10, 2025 16:31 Inactive
src/Std/Internal/Async/Basic.lean Outdated Show resolved Hide resolved
src/Std/Internal/Async/Timer.lean Outdated Show resolved Hide resolved
src/Std/Internal/Async/Timer.lean Outdated Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 13, 2025 12:22 Inactive
@hargoniX hargoniX enabled auto-merge January 13, 2025 15:09
@hargoniX hargoniX disabled auto-merge January 13, 2025 15:10
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 13, 2025 15:40 Inactive
algebraic-dev and others added 6 commits January 13, 2025 17:58
Co-authored-by: Henrik Böving <hargonix@gmail.com>
This PR adds support for `Timer` and a event loop thread that gets
requests from another threads and executes it.

---------

Co-authored-by: Markus Himmel <markus@himmel-villmar.de>
Co-authored-by: Henrik Böving <hargonix@gmail.com>
This PR implements a basic asynchronous timer API on top of the libuv
work.

It purposely puts this into `Std.Internal` as we might still have to
change the API as we continue develop of the async library across
releases so I would only like to stabilize it once we are certain this
is a fine API.

A few additional notes:
- we currently do not implement a bind operator on `AsyncTask` on
purpose as `Task.bind` on `Task.pure` is a non trivial operation and
users should be aware of it. Furthermore there is the consideration that
as they will have to bind on both `IO` and `AsyncTask` we might want to
make potential task points explicit in the syntax (did somebody say
`await`?).
- the API generally takes inspiration from
https://docs.rs/tokio/latest/tokio/time/index.html, though it has to
adapt as Rust's and Lean's asynchronity concepts are sufficiently
different.

Stacked on top of #6219.
Co-authored-by: Markus Himmel <markus@lean-fro.org>
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 13, 2025 17:14 Inactive
@hargoniX hargoniX added this pull request to the merge queue Jan 13, 2025
Merged via the queue into master with commit e6a6437 Jan 13, 2025
22 checks passed
@hargoniX hargoniX deleted the ft-async branch January 13, 2025 18:39
luisacicolini pushed a commit to opencompl/lean4 that referenced this pull request Jan 21, 2025
This PR implements a basic async framework as well as asynchronously
running timers using libuv.

---------

Co-authored-by: Sofia Rodrigues <sofia@algebraic.dev>
Co-authored-by: Markus Himmel <markus@himmel-villmar.de>
Co-authored-by: Markus Himmel <markus@lean-fro.org>
JovanGerb pushed a commit to JovanGerb/lean4 that referenced this pull request Jan 21, 2025
This PR implements a basic async framework as well as asynchronously
running timers using libuv.

---------

Co-authored-by: Sofia Rodrigues <sofia@algebraic.dev>
Co-authored-by: Markus Himmel <markus@himmel-villmar.de>
Co-authored-by: Markus Himmel <markus@lean-fro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features, tactics, and metaprograms release-ci Enable all CI checks for a PR, like is done for releases toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants